package org.example.tinyurl.algorithm;

import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue;

import java.util.Arrays;
import java.util.Collection;

/**
 * @author: zk
 * @date: 2023/6/21 19:09
 * 范围查找时分库策略定制
 */
public class MyDBRangeAlgorithm implements RangeShardingAlgorithm<Long> {
    @Override
    public Collection<String> doSharding(Collection<String> collection, RangeShardingValue<Long> rangeShardingValue) {
        // 范围查询库
        return Arrays.asList("db1", "db2", "db3", "db4");
    }
}
